package com.erp.remote.information;


import com.erp.util.AjaxResult;
import com.erp.util.AmountDTO;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.HashSet;
import java.util.List;
import java.util.Map;


@RequestMapping("/information/client")
public interface ClientRemote {

    /**
     * 获取全部客户的数据
     *
     * @return
     */
    @RequestMapping("/allClient")
    AjaxResult allClient(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize);

    @RequestMapping("/selectClientByCompanyId")
    AjaxResult selectClientByCompanyId(@RequestParam("companyId") Integer companyId);


    /**
     * 根据客户的编号，名称，联系人，电话，送货地址，备注模糊查询客户
     *
     * @param params
     * @return
     */
    @RequestMapping("/getClientByDescription")
    AjaxResult getClientByDescription(@RequestBody Map<String, Object> params);


    @PostMapping("/addClient")
    AjaxResult addClient(@RequestBody Map<String, Object> params);

    /**
     * 用于在新增时，根据clientCode验证客户是否唯一
     *
     * @param clientCode
     * @return
     */
    @RequestMapping("/checkClientOnly")
    AjaxResult checkClientOnly(@RequestParam("clientCode") String clientCode);


    /**
     * 启用客户
     *
     * @param params
     * @return
     */
    @PostMapping("/enableClient")
    AjaxResult enableClient(@RequestBody Map<String, Object> params);

    /**
     * 禁用客户
     *
     * @param params
     * @return
     */
    @PostMapping("/disableClient")
    AjaxResult disableClient(@RequestBody Map<String, Object> params);

    /**
     * 删除客户--逻辑删除
     *
     * @param params
     * @return
     */
    @PostMapping("/deleteClient")
    AjaxResult deleteClient(@RequestBody Map<String, Object> params);

    @RequestMapping("/selectContanterByClientId")
    AjaxResult selectContanterByClientId(@RequestParam("clientId") Integer clientId);

    @PostMapping("/updateClientAndContanter")
    AjaxResult updateClientAndContanter(@RequestBody Map<String, Object> param);


    //批量修改客户数据
    @PostMapping("/batchUpdate")
     AjaxResult batchUpdate(@RequestBody Map<String, Object> params);


    @PostMapping("/selectClientInIDSet")
    AjaxResult selectClientInIDSet(@RequestBody HashSet<Integer> clientIds);

    @RequestMapping("/selectClientByCompanyIdPage")
    AjaxResult selectClientByCompanyIdPage(@RequestBody Map<String,Object> params);

    @PostMapping("/batchUpdateBalance")
    AjaxResult batchUpdateBalance(@RequestBody List<AmountDTO> list);


    /**
     * 根据Id查询客户
     * @param clientId
     * @return
     */

    @PostMapping("/selectClientByClientId")
    AjaxResult selectClientByClientId(@RequestParam("clientId") Integer clientId);

    @PostMapping("/selectClientByCategoryId")
    AjaxResult selectClientByCategoryId(@RequestParam("categoryId") Integer categoryId,@RequestParam("companyId") Integer companyId);

    @PostMapping("/selectClientByLevelId")
    AjaxResult selectClientByLevelId(@RequestParam("levelId") Integer levelId,@RequestParam("companyId") Integer companyId);


    @PostMapping("/selectClientIdsByClientNameOrContanterName")
    AjaxResult selectClientIdsByClientNameOrContanterName(@RequestParam("companyId") Integer companyId,@RequestParam("description") String description);


    /**
     * 计算客户的总欠款
     * @param companyId
     * @return
     */
    @PostMapping("/selectClientPayableBalanceByCompanyId")
    AjaxResult selectClientPayableBalanceByCompanyId(@RequestParam("companyId") Integer companyId);
}
